/**   
* @Title: SysRightDaoImpl.java 
* @Description: TODO
* @author feifei
* @date 2015-4-30 上午10:00:20 
*/
package cn.ainit.sys.right;

import java.sql.CallableStatement;
import java.sql.Connection;
import java.sql.ResultSet;
import java.sql.Types;
import java.util.List;
import java.util.Map;

import javax.sql.DataSource;

import oracle.jdbc.driver.OracleTypes;

import org.springframework.stereotype.Repository;

import cn.ainit.sys.common.dao.BusinessBaseDao;
import cn.ainit.sys.menu.SessionCont;

/** 
 * @ClassName: SysRightDaoImpl 
 * @Description: TODO
 * @author feifei
 * @date 2015-4-30 上午10:00:20 
 */
@Repository
public class SysRightDaoImpl extends BusinessBaseDao implements SysRightDao{


	@Override
	public ReturnRightObj listPageRight(ReturnRightObj rightObj)
			throws Exception {
		Connection conn=null;
		CallableStatement cs=null;
		try {
			conn=this.getJdbcTemplate().getDataSource().getConnection();
			String callName = "{Call PK_RIGHT_FUNC.UP_GetGridRIGHT(?,?,?,?,?,?,?)}";
			cs=conn.prepareCall(callName);
			cs.setString(1,rightObj.getMid());
			cs.setString(2,rightObj.getUid());
			cs.setString(3,rightObj.getStid());
			cs.registerOutParameter(4,OracleTypes.CURSOR);
			cs.registerOutParameter(5,OracleTypes.CURSOR);
			cs.registerOutParameter(6,OracleTypes.CURSOR);
			cs.registerOutParameter(7,OracleTypes.CURSOR);
			cs.execute();
			rightObj.setButnList((ResultSet)cs.getObject(4));
			rightObj.setDefQRConfig((ResultSet)cs.getObject(5));
			rightObj.setAllQRConfig((ResultSet)cs.getObject(6));
			rightObj.setListColns((ResultSet)cs.getObject(7));
		} catch (Exception e) {
			e.printStackTrace();
		}finally{
			if(cs!=null){
				cs.close();
			}
			if(conn!=null){
				conn.close();
			}
		}
		return rightObj;
	}
}
